package tests;

import java.io.BufferedReader;
import java.io.InputStreamReader;

import java.util.Scanner;
public class test7 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = 0;  //怪物的初始能力
        int ability = 0; //小易的初始能力值
        while (sc.hasNext()) {
            n = sc.nextInt();
            ability = sc.nextInt();
            for (int i = 0; i < n; i++) {
                int monster = sc.nextInt(); //怪物的防御能力
                if (monster <= ability) {
                    ability += monster;
                } else {
                    ability += GD(monster, ability);
                }
            }
            System.out.println(ability);
        }
        sc.close();
    }

    public static int GD(int a, int b) {
        int temp;
        while (b > 0) {
            temp = b;
            b = a % b;
            a = temp;
        }
        return a;
    }
}

